//
//  LYYListTableViewCell.m
//  Icar
//
//  Created by dllo on 15/10/24.
//  Copyright © 2015年 小龙侠. All rights reserved.
//

#import "LYYListTableViewCell.h"

@implementation LYYListTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self setUpCell];
    }
    return self;
}

- (void)setUpCell{
    
    self.dateLabel = [[UILabel alloc]initWithFrame:CGRectMake(WIDTH(5), HEIGHT(5), WIDTH(100), HEIGHT(25))];
    [self.dateLabel setBackgroundColor:[LYYNightModeHandle shareNightModeHandle].nightModeColor];
    [self.dateLabel setTextColor:[LYYNightModeHandle shareNightModeHandle].wordColor];
    [self.contentView addSubview:self.dateLabel];
    
    self.titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(WIDTH(110), HEIGHT(5), WIDTH(260), HEIGHT(25))];
    self.titleLabel.numberOfLines = 1;
    [self.contentView addSubview:self.titleLabel];
    [self.titleLabel setBackgroundColor:[LYYNightModeHandle shareNightModeHandle].nightModeColor];
    [self.titleLabel setTextColor:[LYYNightModeHandle shareNightModeHandle].wordColor];
    
    self.listen = [[UIImageView alloc]initWithFrame:CGRectMake(WIDTH(5), HEIGHT(37), WIDTH(15), HEIGHT(15))];
    [self.contentView addSubview:self.listen];
    [self.listen setImage:[UIImage imageNamed:@"iconfont-headphones"]];
    
    self.count = [[UILabel alloc]initWithFrame:CGRectMake(WIDTH(24), HEIGHT(37), WIDTH(60), HEIGHT(15))];
    [self.contentView addSubview:self.count];
    [self.count setTextColor:[UIColor colorWithWhite:0.298 alpha:1.000]];
    self.count.backgroundColor = [LYYNightModeHandle shareNightModeHandle].nightModeColor ;
    
    self.timer = [[UIImageView alloc]initWithFrame:CGRectMake(WIDTH(80), HEIGHT(37), WIDTH(15), HEIGHT(15))];
    [self.contentView addSubview:self.timer];
    [self.timer setImage:[UIImage imageNamed:@"iconfont-dingshiguanbi-1"]];
    
    self.timeLabel = [[UILabel alloc]initWithFrame:CGRectMake(WIDTH(99), HEIGHT(37), WIDTH(80), HEIGHT(15))];
    [self.timeLabel setBackgroundColor:[LYYNightModeHandle shareNightModeHandle].nightModeColor];
    [self.contentView addSubview:self.timeLabel];
    [self.timeLabel setTextColor:[UIColor colorWithWhite:0.298 alpha:1.000]];
    
    self.sizeLabel = [[UILabel alloc]initWithFrame:CGRectMake(WIDTH(185), HEIGHT(37), WIDTH(60), HEIGHT(15))];
    [self.sizeLabel setTextColor:[UIColor colorWithWhite:0.298 alpha:1.000]];
    [self.contentView addSubview:self.sizeLabel];
    [self.sizeLabel setBackgroundColor:[LYYNightModeHandle shareNightModeHandle].nightModeColor];
    
//    self.downLoad = [UIButton buttonWithType:UIButtonTypeCustom];
//    [self.contentView addSubview:self.downLoad];
//    [self.downLoad setFrame:CGRectMake(WIDTH(340), HEIGHT(30), WIDTH(30), HEIGHT(30))];
//    
//    if ([LYYNightModeHandle shareNightModeHandle].temp == YES) {
//        [self.downLoad setImage:[UIImage imageNamed:@"iconfont-xiazai-1"] forState:UIControlStateNormal];
//    }else{
//        [self.downLoad setImage:[UIImage imageNamed:@"iconfont-xiazai"] forState:UIControlStateNormal];
//    }
    
    
    if (SCREEN_HEIGHT == 736) {
        [self.dateLabel setFont:[UIFont systemFontOfSize:19.]];
        [self.titleLabel setFont:[UIFont systemFontOfSize:19.]];
        [self.timeLabel setFont:[UIFont systemFontOfSize:16.]];
        [self.count setFont:[UIFont systemFontOfSize:16.]];
        [self.sizeLabel setFont:[UIFont systemFontOfSize:16.]];
    }else if(SCREEN_HEIGHT == 667){
        [self.dateLabel setFont:[UIFont systemFontOfSize:16.]];
        [self.titleLabel setFont:[UIFont systemFontOfSize:16.]];
        [self.timeLabel setFont:[UIFont systemFontOfSize:14.]];
        [self.sizeLabel setFont:[UIFont systemFontOfSize:14.]];
        [self.count setFont:[UIFont systemFontOfSize:14.]];
    }else if (SCREEN_HEIGHT == 568){
        [self.dateLabel setFont:[UIFont systemFontOfSize:15.]];
        [self.titleLabel setFont:[UIFont systemFontOfSize:15.]];
        [self.timeLabel setFont:[UIFont systemFontOfSize:12.]];
        [self.sizeLabel setFont:[UIFont systemFontOfSize:12.]];
        [self.count setFont:[UIFont systemFontOfSize:12.]];
    }else{
        [self.dateLabel setFont:[UIFont systemFontOfSize:13.]];
        [self.titleLabel setFont:[UIFont systemFontOfSize:13.]];
        [self.timeLabel setFont:[UIFont systemFontOfSize:10.]];
        [self.sizeLabel setFont:[UIFont systemFontOfSize:10.]];
        [self.count setFont:[UIFont systemFontOfSize:10.]];
    }
}

- (void)getModel:(LYYListModel *)model{
    
    [self.dateLabel setText:model.program_live_time];
    [self.timeLabel setText:model.program_time_length];
    [self.sizeLabel setText:model.program_file_size];
    [self.count setText:[NSString stringWithFormat:@"%ld",model.program_join_num]];
    [self.titleLabel setText:model.program_title];
   
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
